<template>
  <div class="body-bg-img">
    <div v-for="(item, i) in imgList" :key="i" class="slideshow-image">
      <img :src="item.url" />
    </div>
  </div>
</template>

<script lang="ts" setup>
const imgList = [
  { url: 'imgs/business/front-home/header-default.jpg' },
  { url: 'imgs/business/front-home/bg-1.jpg' },
  { url: 'imgs/business/front-home/bg-2.jpg' },
  { url: 'imgs/business/front-home/bg-3.jpg' }
]
</script>

<style lang="scss" scoped>
.body-bg-img {
  img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }
}

.slideshow-image {
  position: absolute;
  width: 100%;
  height: 100%;
  background-size: cover;
  opacity: 1;
  transform: scale(1.2);
  animation-duration: 16s;
  animation-iteration-count: infinite;
  animation-name: kenburns;
  animation-timing-function: linear;
}

.slideshow-image:nth-child(1) {
  z-index: 3;
  animation-name: kenburns-1;
}

.slideshow-image:nth-child(2) {
  z-index: 2;
  animation-name: kenburns-2;
}

.slideshow-image:nth-child(3) {
  z-index: 1;
  animation-name: kenburns-3;
}

.slideshow-image:nth-child(4) {
  z-index: 0;
  animation-name: kenburns-4;
}

@keyframes kenburns-1 {
  0% {
    opacity: 1;
    transform: scale(1.2);
  }

  1.5625% {
    opacity: 1;
  }

  23.4375% {
    opacity: 1;
  }

  26.5625% {
    opacity: 0;
    transform: scale(1);
  }

  100% {
    opacity: 0;
    transform: scale(1.2);
  }

  98.4375% {
    opacity: 0;
    transform: scale(1.21176);
  }

  100% {
    opacity: 1;
  }
}

@keyframes kenburns-2 {
  23.4375% {
    opacity: 1;
    transform: scale(1.2);
  }

  26.5625% {
    opacity: 1;
  }

  48.4375% {
    opacity: 1;
  }

  51.5625% {
    opacity: 0;
    transform: scale(1);
  }

  100% {
    opacity: 0;
    transform: scale(1.2);
  }
}

@keyframes kenburns-3 {
  48.4375% {
    opacity: 1;
    transform: scale(1.2);
  }

  51.5625% {
    opacity: 1;
  }

  73.4375% {
    opacity: 1;
  }

  76.5625% {
    opacity: 0;
    transform: scale(1);
  }

  100% {
    opacity: 0;
    transform: scale(1.2);
  }
}

@keyframes kenburns-4 {
  73.4375% {
    opacity: 1;
    transform: scale(1.2);
  }

  76.5625% {
    opacity: 1;
  }

  98.4375% {
    opacity: 1;
  }

  100% {
    opacity: 0;
    transform: scale(1);
  }
}
</style>
